package com.snopy.designPattern.create.abstractFactory;

import com.snopy.designPattern.create.simpleFactory.SimpleCarFactory;
import com.snopy.designPattern.create.simpleFactory.SimpleShipFactory;

/**
 * @author snopy
 * @version 1.0.0
 * @classname FactoryProducer
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/01 14:55
 */
public class FactoryProducer {

    public static AbstractFactory getFactory(String factoryName){
        if (factoryName.equalsIgnoreCase("CAR")){
            return new SimpleCarFactory();
        }else if (factoryName.equalsIgnoreCase("SHIP")){
            return new SimpleShipFactory();
        }else{
            throw new RuntimeException("类型不存在！");
        }
    }
}
